﻿<%@ Page Language="C#" Title="模型参数设置" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="Dm_Default_TrafficPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Dm_Default_TrafficPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">    
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Enum.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/JsPage.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Appearance.js")%>

    <script type="text/javascript">      

		var _viewTraffic = new JsPage();
		var _css = new Appearance();

        function onTrafficEditClick() {
            _viewTraffic.EditAction(function () {
                var row = $('#dgTraffic').datagrid('getSelected');
                if (row)
                {
                    var wheels = row.Shafttype.split('+');
                    $("tr.c1").show();
                    switch (wheels.length)
                    {
                        case 2:
                            $("tr.c2").hide();
                            $("tr.c3").hide();
                            break;
                        case 3:
                            $("tr.c2").show();
                            $("tr.c3").hide();
                            break;
                        case 4:
                            $("tr.c2").show();
                            $("tr.c3").show();
                            break;
                    }
                }

            });
        }
        function onTrafficSumbitClick() {
            $.messager.progress({
                title: '请等待',
                msg: '加载数据中...'
            });

            var data = $('#fmTraffic').formToArray();
            if (!data) return;

            data = jQuery.grep(data, function (value) {
                return value.name != 'Cartype';
            });
            //data.splice(2,2);
            var str = $("#Cartype").combobox('getValues').join(",");
            data.push({ name: "Cartype", value: str });

            $.ajax({
                type: "POST",
                url: "/api/default/traffic",
                data: data,
                complete: function () {
                    $.messager.progress('close');
                },
                success: function (msg) {
                    if (msg.length >= 1) {
                        $.messager.alert('错误提示', msg, "error");
                    }
                    else {
                        $('#dgTraffic').data().datagrid.selectRowIndex = null;
                        $('#dgTraffic').datagrid('reload');
                        $('#dlgTraffic').dialog('close');
                    }
                },
                error: Common.ShowError
            });
        }
        function onTrafficCloseClick() {
            _viewTraffic.closeDialog();
        }

        $(function () {                       
            $("#btnTrafficEdit").on("click", onTrafficEditClick);
            $("#btnTrafficSave").on("click", onTrafficSumbitClick);
            $("#btnTrafficCancel").on("click", onTrafficCloseClick);

            _viewTraffic.PageSize = 20;
            _viewTraffic.setForm($('#fmTraffic'))
                .setDialog($('#dlgTraffic'))
                .setDataGrid($('#dgTraffic'))
                .loadDataGrid("/api/default/traffic");
        });        
    </script>  
    
      <script type="text/javascript">      

          var _viewCar = new JsPage();

          function onEditCarClick() {
              _viewCar.EditAction();
          }
          function onSumbitCarClick() {
              _viewCar.sumbitForm();
          }
          function onCloseCarClick() {
              _viewCar.closeDialog();
          }

          $(function () {           
            
              $("#btnCarEdit").on("click", onEditCarClick);
              $("#btnCarSave").on("click", onSumbitCarClick);
              $("#btnCarCancel").on("click", onCloseCarClick);

              _viewCar.setForm($('#fmCar'))
                  .setDialog($('#dlgCar'))
                  .setDataGrid($('#dgCar'))
                  .loadDataGrid("/api/default/car");
          });
    </script>   
    

   <script type="text/javascript">

       var _viewRating = new JsPage();

       function onEditRatingClick() {
           _viewRating.EditAction();
       }
       function onSumbitRatingClick() {
           _viewRating.sumbitForm();
       }
       function onCloseRatingClick() {
           _viewRating.closeDialog();
       }

       $(function () {

           $("#btnRatingEdit").on("click", onEditRatingClick);
           $("#btnRatingSave").on("click", onSumbitRatingClick);
           $("#btnRatingCancel").on("click", onCloseRatingClick);

           _viewRating.setForm($('#fmRating'))
               .setDialog($('#dlgRating'))
               .setDataGrid($('#dgRating'))
               .loadDataGrid("/api/default/rating");
       });


    </script>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="easyui-tabs" >
		<div title="轴型轮组" style="padding:10px">
			 <table id="dgTraffic" class="easyui-datagrid content-place"  data-ajaxcached="false"  data-options='{
                  "toolbar": "#tbTraffic",
                  "method": "get",
                  "iconCls": "icon-edit",
                  "width": "auto",
                  "height": "auto",
                  "nowrap": false,
                  "striped": true,
                  "border": true,
                  "collapsible": false,
                  "fit": false,
                  "singleSelect": true,
                  "rownumbers": true,
                  "pagination": true
                }' >
                <thead>
                    <tr>
                        <th data-options="field:'Id',editor:'text',width:80,align:'center',hidden:true">ID</th>
                        <th data-options="field:'Carmame',editor:'text',width:130,align:'center'">代表车型</th>
                        <th data-options="field:'Cartype',editor:'text',width:200,align:'center',formatter:_css.formatCarType ">货车类型</th>
                        <th data-options="field:'Shafttype',editor:'text',width:80,align:'center' ">轴型轮组类型</th>
                        <th data-options="field:'Front_Axle',editor:'numberbox',width:100,align:'center' ">前轴轴重（kN）</th>
                        <th data-options="field:'C_Front_Axle',editor:'numberbox',width:100,align:'center' ">中前轴轴重（kN）</th>
                        <th data-options="field:'C_Rrear_Axle',editor:'numberbox',width:100,align:'center' ">中后轴轴重（kN）</th>
                        <th data-options="field:'Rear_Axle',editor:'numberbox',width:100,align:'center' ">后轴轴重（kN）</th>
                        <th data-options="field:'Front_Axes',editor:'numberbox',width:60,align:'center' ">前轴轴数</th>
                        <th data-options="field:'C_Front_Axes',editor:'numberbox',width:80,align:'center' ">中前轴轴数</th>
                        <th data-options="field:'C_Rrear_Axes',editor:'numberbox',width:80,align:'center' ">中后轴轴数</th>
                        <th data-options="field:'Rear_Axes',editor:'numberbox',width:60,align:'center' ">后轴轴数</th>
                        <th data-options="field:'Front_Wheels',editor:'numberbox',width:80,align:'center' ">前轴轮组数</th>
                        <th data-options="field:'C_Front_Wheels',editor:'numberbox',width:100,align:'center' ">中前轴轮组数</th>
                        <th data-options="field:'C_Rrear_Wheel',editor:'numberbox',width:100,align:'center' ">中后轴轮组数</th>
                        <th data-options="field:'Rear_Wheels',editor:'numberbox',width:100,align:'center' ">后轴轮组数</th>
                    </tr>
                </thead>
            </table>
   
            <div id="tbTraffic">
                <a id="btnTrafficEdit"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" >编辑</a>
            </div>

            <div id="dlgTraffic" class="easyui-dialog" title="保存数据" style="width:400px;height:420px;padding:10px" data-options="
                            closed:true,
				            iconCls: 'icon-save',
				            buttons: '#dlgTraffic-buttons'">
                <form id="fmTraffic" class="easyui-form"  method="post" action="/api/default_traffic"   >
                    <table>			     
                        <tr style="display:none">
                            <td>ID:</td>
                            <td><input name='Id' class='easyui-textbox'  /></td>
                        </tr>
                        <tr>
                            <td>代表车型:</td>
                            <td><input name='Carmame' class='easyui-textbox' data-options="readonly:true" /></td>
                        </tr>
                        <tr>
                            <td>货车类型:</td>                    
                            <td><input id="Cartype" name='Cartype'  class="easyui-combobox" data-options="required:true,prompt:'货车类型',valueField:'id',textField:'text',url:'/api/data/car',method:'get',multiple:true"/></td>
                        </tr>
                        <tr >
                            <td>轴型轮组类型:</td>
                            <td><input name='Shafttype' class='easyui-textbox' data-options="readonly:true" /></td>
                        </tr>    
                        <tr class="c1">
                            <td>前轴轴重（kN）:</td>
                            <td><input name='Front_Axle' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c2">
                            <td>中前轴轴重（kN）:</td>
                            <td><input name='C_Front_Axle' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c3">
                            <td>中后轴轴重（kN）:</td>
                            <td><input name='C_Rrear_Axle' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c1">
                            <td>后轴轴重（kN）:</td>
                            <td><input name='Rear_Axle' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c1">
                            <td>前轴轴数:</td>
                            <td><input name='Front_Axes' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c2">
                            <td>中前轴轴数:</td>
                            <td><input name='C_Front_Axes' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c3">
                            <td>中后轴轴数:</td>
                            <td><input name='C_Rrear_Axes' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c1">
                            <td>后轴轴数:</td>
                            <td><input name='Rear_Axes' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c1">
                            <td>前轴轮组数:</td>
                            <td><input name='Front_Wheels' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c2">
                            <td>中前轴轮组数:</td>
                            <td><input name='C_Front_Wheels' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c3">
                            <td>中后轴轮组数:</td>
                            <td><input name='C_Rrear_Wheel' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr class="c1">
                            <td>后轴轮组数:</td>
                            <td><input name='Rear_Wheels' class='easyui-numberbox '  data-options='min:0,precision:2' /></td>
                        </tr>

		            </table>
                </form>
            </div>

            <!--编辑数据命令-->
            <div id="dlgTraffic-buttons">
		        <a id="btnTrafficSave" href="javascript:void(0)" class="easyui-linkbutton" >保存</a>
		        <a id="btnTrafficCancel" href="javascript:void(0)" class="easyui-linkbutton" >取消</a>
	        </div>
		</div>

		<div title="沥青路面车道系数" style="padding:10px">
             <table id="dgCar"  class="easyui-datagrid content-place"  data-ajaxcached="false"  data-options='{
                  "toolbar": "#tbCar",
                  "method": "get",
                  "iconCls": "icon-edit",
                  "width": "auto",
                  "height": "auto",
                  "nowrap": false,
                  "striped": true,
                  "border": true,
                  "collapsible": false,
                  "fit": false,
                  "singleSelect": true,
                  "rownumbers": true,
                  "pagination": true
                }' >
                <thead>
			        <tr>
				        <th data-options="field:'Id',editor:'text',width:80,align:'center',hidden:true">ID</th>
                        <th data-options="field:'Comment',editor:'text',width:160,align:'center' ">车道特征</th>
                        <th data-options="field:'Lanes',editor:'text',width:120,align:'center' ">车道数</th>
                        <th data-options="field:'Lanerange',editor:'numberbox',width:120,align:'center' ,hidden:true">车道系数取值范围</th>
                        <th data-options="field:'Lanecoef',editor:'numberbox',width:120,align:'center' ">车道系数</th>		
                        <th data-options="field:'Directrange',editor:'numberbox',width:120,align:'center',hidden:true ">方向系数取值范围</th>	
                        <th data-options="field:'Directcoef',editor:'numberbox',width:120,align:'center' ">方向系数</th>			
			        </tr>
                </thead>
            </table>
   
            <div id="tbCar">
                <a id="btnCarEdit"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" >编辑</a>    
            </div>

            <div id="dlgCar" class="easyui-dialog" title="保存数据" style="width:350px;height:260px;padding:10px" data-options="
                        closed:true,
				        iconCls: 'icon-save',
				        buttons: '#dlgCar-buttons'">
                <form id="fmCar" class="easyui-form"  method="post" action="/api/default/car" >
                    <table>			     
                        <tr style="display:none">
                            <td>ID:</td>
                            <td><input name='Id' class='easyui-textbox'  data-options='readonly:true' /></td>
                        </tr>
                        <tr>
                            <td>车道特征:</td>
                            <td><input name='Comment' class='easyui-textbox'  data-options='readonly:true' /></td>
                        </tr>
                        <tr>
                            <td>车道数:</td>
                            <td><input name='Lanes' class='easyui-textbox' data-options='readonly:true'  /></td>
                        </tr>
                         <tr style="display:none">
                            <td>车道系数取值范围:</td>
                            <td><input name='Lanerange' class='easyui-textbox'  data-options='readonly:true' /></td>
                        </tr>
                        <tr>
                            <td>车道系数:</td>
                            <td><input name='Lanecoef' class='easyui-numberbox'  data-options='min:0,precision:2' /></td>
                        </tr>
                        <tr style="display:none">
                            <td>方向系数取值范围:</td>
                            <td><input name='Directrange' class='easyui-textbox'  data-options='readonly:true' /></td>
                        </tr>
                        <tr>
                            <td>方向系数:</td>
                            <td><input name='Directcoef' class='easyui-numberbox'  data-options='min:0,precision:2' /></td>
                        </tr>
		            </table>
                </form>
            </div>

            <!--编辑数据命令-->
            <div id="dlgCar-buttons">
		        <a id="btnCarSave" href="javascript:void(0)" class="easyui-linkbutton" >保存</a>
		        <a id="btnCarCancel" href="javascript:void(0)" class="easyui-linkbutton" >取消</a>
	        </div>
		</div>
        
        <div title="设计年限" style="padding:10px">
			 <table id="dgRating"  class="easyui-datagrid content-place"  data-ajaxcached="false"  data-options='{
                  "toolbar": "#tbRating",
                  "method": "get",
                  "iconCls": "icon-edit",
                  "width": "auto",
                  "height": "auto",
                  "nowrap": false,
                  "striped": true,
                  "border": true,
                  "collapsible": false,
                  "fit": false,
                  "singleSelect": true,
                  "rownumbers": true,
                  "pagination": true
                }' >
                <thead>
			        <tr>
				        <th data-options="field:'Id',editor:'text',width:80,align:'center' ,hidden:true">ID</th>
				        <th data-options="field:'Rdclass_Dictid',editor:'numberbox',width:80,align:'center',formatter:formatEnum ">技术等级</th>
				        <th data-options="field:'Year_Asp',editor:'text',width:200,align:'center' ">沥青路面设计年限(年)</th>
				        <th data-options="field:'Year_Cem',editor:'text',width:200,align:'center' ">水泥路面设计年限(年)</th>
				        <th data-options="field:'Growth_Rate',editor:'numberbox',width:80,align:'center' ">增长率</th>		                        
                        <th data-options="field:'Year_Aspmin',editor:'text',width:80,align:'center' ,hidden:true">沥青路面设计年限最小值</th>
                        <th data-options="field:'Year_Aspmax',editor:'text',width:80,align:'center' ,hidden:true">沥青路面设计年限最大值</th>
                        <th data-options="field:'Growth_Ratemin',editor:'numberbox',width:80,align:'center' ,hidden:true">增长率最小值</th>
                        <th data-options="field:'Growth_Ratemax',editor:'numberbox',width:80,align:'center' ,hidden:true">增长率最大值</th>	
			        </tr>
                </thead>
            </table>
   
            <div id="tbRating">
                <a id="btnRatingEdit"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" >编辑</a>
            </div>

            <div id="dlgRating" class="easyui-dialog" title="保存数据" style="width:400px;height:230px;padding:10px" data-options="
                        closed:true,
				        iconCls: 'icon-save',
				        buttons: '#dlgRating-buttons'">
			        <form id="fmRating" class="easyui-form"  method="post" action="/api/default/rating" >
				        <table>			     
					        <tr style="display:none">
						        <td>ID:</td>
						        <td><input name='Id' class='easyui-textbox'  /></td>
					        </tr>
					        <tr>
						        <td>技术等级：</td>
					                <td><input name='Rdclass_Dictid'  class="easyui-combobox"  data-options="prompt:'技术等级',required:true,valueField:'id',textField:'text',url:'/api/data/roadclass',method:'get' "/></td>
                            </tr>
					        <tr>
						        <td>沥青路面设计年限(年):</td>
						        <td><input name='Year_Asp' class='easyui-textbox'  /></td>
					        </tr>
                              <tr>
						        <td>水泥路面设计年限(年):</td>
						        <td><input name='Year_Cem' class='easyui-textbox'  /></td>
					        </tr>
					        <tr>
						        <td>增长率:</td>
						        <td><input name='Growth_Rate' class='easyui-numberbox'  data-options='min:0,precision:2' /></td>
					        </tr>

                            <tr style="display:none">
                                <td>沥青路面设计年限最小值:</td>
                                <td><input name='Year_Aspmin' class='easyui-textbox'  /></td>
                            </tr>
                            <tr style="display:none">
                                <td>沥青路面设计年限最大值:</td>
                                <td><input name='Year_Aspmax' class='easyui-textbox'  /></td>
                            </tr>
                            <tr style="display:none">
                                <td>增长率最小值:</td>
                                <td><input name='Growth_Ratemin' class='easyui-numberbox'  data-options='min:0,precision:2' /></td>
                            </tr>
                            <tr style="display:none">
                                <td>增长率最大值:</td>
                                <td><input name='Growth_Ratemax' class='easyui-numberbox'  data-options='min:0,precision:2' /></td>
                            </tr>
				        </table>
			        </form>
            </div>

            <!--编辑数据命令-->
            <div id="dlgRating-buttons">
		        <a id="btnRatingSave" href="javascript:void(0)" class="easyui-linkbutton" >保存</a>
		        <a id="btnRatingCancel" href="javascript:void(0)" class="easyui-linkbutton" >取消</a>
	        </div>
		</div>
	</div>


   
</asp:Content>
